#include "dialog.h"
#include "ui_dialog.h"
#include <QMessageBox>
Dialog *Dialog::myDialog=nullptr;
Dialog::Dialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Dialog)
{
    ui->setupUi(this);
}

Dialog::~Dialog()
{
    delete ui;
}

void Dialog::on_pushButton_clicked()
{
//    QString friendname=mysocket->Addfriend(ui->lineEdit->text());
//if(friendname!=""){
//  addsuccess *success=new  addsuccess;
//            myfriendlist->addfriend(ui->lineEdit->text(),friendname);
//            myfriendlist->show();
//           success->show();
//           this->close();
//}
//    if(ui->lineEdit->text() == tr("0000"))
//        {
//           accept();
//        } else {
//           QMessageBox::warning(this, tr("Waring"),
//                                 tr("账户不存在！"),
//                                 QMessageBox::Yes);
//           ui->lineEdit->clear();
//}
  emit(addfriend(ui->lineEdit->text()));
    close();


}
void Dialog::GetTCPSocket(TCPSocket *socket){

  mysocket=socket;
}
void Dialog::Getfriendlist(friendlist *friendlist){

  myfriendlist=friendlist;
}
